﻿using JetBrains.Annotations;
using MugenMvvmToolkit.Interfaces.ViewModels;
using MugenMvvmToolkit.Interfaces.Views;

namespace MugenMvvmToolkit.Interfaces
{
    /// <summary>
    /// Represents the view model navigation cache policy.
    /// </summary>
    public interface INavigationCachePolicy
    {
        /// <summary>
        ///     Tries to save a view model in the cache.
        /// </summary>
        void TryCacheViewModel([NotNull]INavigationContext context, [NotNull] IView view, [NotNull] IViewModel viewModel);

        /// <summary>
        ///     Tries to get view model from the cache, and delete it from the cache.
        /// </summary>
        IViewModel TryTakeViewModelFromCache([NotNull]INavigationContext context, [NotNull] IView view);

        /// <summary>
        /// Removes the view model from cache.
        /// </summary>
        bool Clear([NotNull]IViewModel viewModel);

        /// <summary>
        /// Clears the cache.
        /// </summary>
        void Clear();
    }
}